<?php
/**
 * 2017年6月7日11:05:50
 * PDO SAFE
 */

include 'common.php';

$wish_id = $_REQUEST['wishid'];

$dbc = pdo_root_connect();
$stmt = $dbc->prepare('select * from comment where wish_id=:wishid');
$stmt->bindParam(':wishid', $wish_id, PDO::PARAM_INT);
//$queryAllReply = mysql_query("select * from comment where wish_id='$wish_id'");
$stmt->execute();
$replylist = array();
$errorcode = 1;

while($row = $stmt->fetch()){
	array_push($replylist, ['id'=>(int)$row['id'], 'parentid'=>(int)$row['parent_id'], 'username'=>$row['username'], 'time'=>(int)$row['create_time'], 'content'=>$row['content']]);
	$errorcode = 1;
}
// $replylist[$count]->id = (int)$queryRow['id'];
// $replylist[$count]->parentid = (int)$queryRow['parent_id'];
// $replylist[$count]->username = $queryRow['username'];
// $replylist[$count]->content = $queryRow['content'];
// $replylist[$count]->time = (int)$queryRow['create_time'];

echo json_encode(array('errorcode'=>$errorcode, 'replylist'=>$replylist));
?>